/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Meas.impl;

import EA_Model.IEC61970.Core.impl.IdentifiedObjectImpl;

import EA_Model.IEC61970.Domain.UnitMultiplier;
import EA_Model.IEC61970.Domain.UnitSymbol;

import EA_Model.IEC61970.Meas.MeasPackage;
import EA_Model.IEC61970.Meas.Measurement;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Measurement</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.MeasurementImpl#getMeasurementType <em>Measurement Type</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.MeasurementImpl#getUnitMultiplier <em>Unit Multiplier</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.MeasurementImpl#getUnitSymbol <em>Unit Symbol</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MeasurementImpl extends IdentifiedObjectImpl implements Measurement {
	/**
	 * The cached value of the '{@link #getMeasurementType() <em>Measurement Type</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMeasurementType()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.String measurementType;

	/**
	 * The default value of the '{@link #getUnitMultiplier() <em>Unit Multiplier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitMultiplier()
	 * @generated
	 * @ordered
	 */
	protected static final UnitMultiplier UNIT_MULTIPLIER_EDEFAULT = UnitMultiplier.P;

	/**
	 * The cached value of the '{@link #getUnitMultiplier() <em>Unit Multiplier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitMultiplier()
	 * @generated
	 * @ordered
	 */
	protected UnitMultiplier unitMultiplier = UNIT_MULTIPLIER_EDEFAULT;

	/**
	 * The default value of the '{@link #getUnitSymbol() <em>Unit Symbol</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitSymbol()
	 * @generated
	 * @ordered
	 */
	protected static final UnitSymbol UNIT_SYMBOL_EDEFAULT = UnitSymbol.VA;

	/**
	 * The cached value of the '{@link #getUnitSymbol() <em>Unit Symbol</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitSymbol()
	 * @generated
	 * @ordered
	 */
	protected UnitSymbol unitSymbol = UNIT_SYMBOL_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MeasurementImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MeasPackage.Literals.MEASUREMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.String getMeasurementType() {
		if (measurementType != null && measurementType.eIsProxy()) {
			InternalEObject oldMeasurementType = (InternalEObject)measurementType;
			measurementType = (EA_Model.IEC61970.Domain.String)eResolveProxy(oldMeasurementType);
			if (measurementType != oldMeasurementType) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.MEASUREMENT__MEASUREMENT_TYPE, oldMeasurementType, measurementType));
			}
		}
		return measurementType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.String basicGetMeasurementType() {
		return measurementType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMeasurementType(EA_Model.IEC61970.Domain.String newMeasurementType) {
		EA_Model.IEC61970.Domain.String oldMeasurementType = measurementType;
		measurementType = newMeasurementType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.MEASUREMENT__MEASUREMENT_TYPE, oldMeasurementType, measurementType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitMultiplier getUnitMultiplier() {
		return unitMultiplier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUnitMultiplier(UnitMultiplier newUnitMultiplier) {
		UnitMultiplier oldUnitMultiplier = unitMultiplier;
		unitMultiplier = newUnitMultiplier == null ? UNIT_MULTIPLIER_EDEFAULT : newUnitMultiplier;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.MEASUREMENT__UNIT_MULTIPLIER, oldUnitMultiplier, unitMultiplier));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitSymbol getUnitSymbol() {
		return unitSymbol;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUnitSymbol(UnitSymbol newUnitSymbol) {
		UnitSymbol oldUnitSymbol = unitSymbol;
		unitSymbol = newUnitSymbol == null ? UNIT_SYMBOL_EDEFAULT : newUnitSymbol;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.MEASUREMENT__UNIT_SYMBOL, oldUnitSymbol, unitSymbol));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT__MEASUREMENT_TYPE:
				if (resolve) return getMeasurementType();
				return basicGetMeasurementType();
			case MeasPackage.MEASUREMENT__UNIT_MULTIPLIER:
				return getUnitMultiplier();
			case MeasPackage.MEASUREMENT__UNIT_SYMBOL:
				return getUnitSymbol();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT__MEASUREMENT_TYPE:
				setMeasurementType((EA_Model.IEC61970.Domain.String)newValue);
				return;
			case MeasPackage.MEASUREMENT__UNIT_MULTIPLIER:
				setUnitMultiplier((UnitMultiplier)newValue);
				return;
			case MeasPackage.MEASUREMENT__UNIT_SYMBOL:
				setUnitSymbol((UnitSymbol)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT__MEASUREMENT_TYPE:
				setMeasurementType((EA_Model.IEC61970.Domain.String)null);
				return;
			case MeasPackage.MEASUREMENT__UNIT_MULTIPLIER:
				setUnitMultiplier(UNIT_MULTIPLIER_EDEFAULT);
				return;
			case MeasPackage.MEASUREMENT__UNIT_SYMBOL:
				setUnitSymbol(UNIT_SYMBOL_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MeasPackage.MEASUREMENT__MEASUREMENT_TYPE:
				return measurementType != null;
			case MeasPackage.MEASUREMENT__UNIT_MULTIPLIER:
				return unitMultiplier != UNIT_MULTIPLIER_EDEFAULT;
			case MeasPackage.MEASUREMENT__UNIT_SYMBOL:
				return unitSymbol != UNIT_SYMBOL_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (unitMultiplier: ");
		result.append(unitMultiplier);
		result.append(", unitSymbol: ");
		result.append(unitSymbol);
		result.append(')');
		return result.toString();
	}

} //MeasurementImpl
